package pattern.principle.srp;

public class UserManager {

	private UserDao userDao = new UserDao();
	
	public boolean checkUser(String name,String pass){
		boolean flag = false;
		User user = userDao.getUserByName(name);
		if(user !=null && user.getUsername().equals(pass)){
			flag = true;
		}
		return flag;
	}
	
	public void registUser(User user){
		if(userDao.getUserByName(user.getUsername()) != null){
			System.out.println("已注册");
			return;
		}
		if(userDao.addUser(user)){
			System.out.println("成功");
		}else{
			System.out.println("失败");
		}
	}
}
